var express = require('express');
var router = express.Router();

const Products = require("../models/productModel.js");
const { showproducts, getproducts,addproducts,updateproducts,deleteproducts} = require("../controllers/products.js")

/* GET home page. */
//获取products集合并渲染
router.get('/showproducts', showproducts);

//新增
router.post('/',addproducts)

//删除
router.delete('/',deleteproducts);

//修改---获取id
router.get('/:_id', getproducts);

//修改--点击确认修改
router.put('/',updateproducts)

module.exports = router;

